#include <ctime>
#include <string>
#include <fstream>

#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>

#ifndef u_char
#define u_char unsigned char
#endif

using namespace std;

static const char* GetMakefile()
{
	static u_char data[] = {
		0x74,0x61,0x72,0x67,0x65,0x74,0x3A,0x20,0x61,0x6C,0x6C,0x0A,0x0A,0x61,0x6C,0x6C,
		0x3A,0x20,0x0A,0x09,0x24,0x28,0x4D,0x41,0x4B,0x45,0x29,0x20,0x2D,0x43,0x20,0x6C,
		0x69,0x62,0x72,0x61,0x72,0x79,0x0A,0x09,0x24,0x28,0x4D,0x41,0x4B,0x45,0x29,0x20,
		0x2D,0x43,0x20,0x74,0x6F,0x6F,0x6C,0x6B,0x69,0x74,0x0A,0x09,0x24,0x28,0x4D,0x41,
		0x4B,0x45,0x29,0x20,0x2D,0x43,0x20,0x77,0x65,0x62,0x61,0x70,0x70,0x2F,0x73,0x72,
		0x63,0x0A,0x09,0x24,0x28,0x4D,0x41,0x4B,0x45,0x29,0x20,0x2D,0x43,0x20,0x77,0x65,
		0x62,0x61,0x70,0x70,0x2F,0x63,0x70,0x70,0x2F,0x6C,0x69,0x62,0x2F,0x77,0x65,0x62,
		0x78,0x0A,0x09,0x24,0x28,0x4D,0x41,0x4B,0x45,0x29,0x20,0x2D,0x43,0x20,0x77,0x65,
		0x62,0x61,0x70,0x70,0x2F,0x63,0x70,0x70,0x2F,0x6C,0x69,0x62,0x2F,0x64,0x62,0x65,
		0x6E,0x74,0x69,0x74,0x79,0x0A,0x09,0x24,0x28,0x4D,0x41,0x4B,0x45,0x29,0x20,0x2D,
		0x43,0x20,0x77,0x65,0x62,0x61,0x70,0x70,0x2F,0x65,0x74,0x63,0x2F,0x70,0x6C,0x75,
		0x67,0x69,0x6E,0x0A,0x09,0x24,0x28,0x4D,0x41,0x4B,0x45,0x29,0x20,0x2D,0x43,0x20,
		0x77,0x65,0x62,0x61,0x70,0x70,0x2F,0x61,0x70,0x70,0x0A,0x09,0x24,0x28,0x4D,0x41,
		0x4B,0x45,0x29,0x20,0x2D,0x43,0x20,0x77,0x65,0x62,0x61,0x70,0x70,0x2F,0x63,0x67,
		0x69,0x0A,0x0A,0x63,0x6C,0x65,0x61,0x6E,0x3A,0x0A,0x09,0x24,0x28,0x4D,0x41,0x4B,
		0x45,0x29,0x20,0x63,0x6C,0x65,0x61,0x6E,0x20,0x2D,0x43,0x20,0x6C,0x69,0x62,0x72,
		0x61,0x72,0x79,0x0A,0x09,0x24,0x28,0x4D,0x41,0x4B,0x45,0x29,0x20,0x63,0x6C,0x65,
		0x61,0x6E,0x20,0x2D,0x43,0x20,0x74,0x6F,0x6F,0x6C,0x6B,0x69,0x74,0x0A,0x09,0x24,
		0x28,0x4D,0x41,0x4B,0x45,0x29,0x20,0x63,0x6C,0x65,0x61,0x6E,0x20,0x2D,0x43,0x20,
		0x77,0x65,0x62,0x61,0x70,0x70,0x2F,0x73,0x72,0x63,0x0A,0x09,0x24,0x28,0x4D,0x41,
		0x4B,0x45,0x29,0x20,0x63,0x6C,0x65,0x61,0x6E,0x20,0x2D,0x43,0x20,0x77,0x65,0x62,
		0x61,0x70,0x70,0x2F,0x63,0x70,0x70,0x2F,0x6C,0x69,0x62,0x2F,0x77,0x65,0x62,0x78,
		0x0A,0x09,0x24,0x28,0x4D,0x41,0x4B,0x45,0x29,0x20,0x63,0x6C,0x65,0x61,0x6E,0x20,
		0x2D,0x43,0x20,0x77,0x65,0x62,0x61,0x70,0x70,0x2F,0x63,0x70,0x70,0x2F,0x6C,0x69,
		0x62,0x2F,0x64,0x62,0x65,0x6E,0x74,0x69,0x74,0x79,0x0A,0x09,0x24,0x28,0x4D,0x41,
		0x4B,0x45,0x29,0x20,0x63,0x6C,0x65,0x61,0x6E,0x20,0x2D,0x43,0x20,0x77,0x65,0x62,
		0x61,0x70,0x70,0x2F,0x65,0x74,0x63,0x2F,0x70,0x6C,0x75,0x67,0x69,0x6E,0x0A,0x09,
		0x24,0x28,0x4D,0x41,0x4B,0x45,0x29,0x20,0x63,0x6C,0x65,0x61,0x6E,0x20,0x2D,0x43,
		0x20,0x77,0x65,0x62,0x61,0x70,0x70,0x2F,0x61,0x70,0x70,0x0A,0x09,0x24,0x28,0x4D,
		0x41,0x4B,0x45,0x29,0x20,0x63,0x6C,0x65,0x61,0x6E,0x20,0x2D,0x43,0x20,0x77,0x65,
		0x62,0x61,0x70,0x70,0x2F,0x63,0x67,0x69,0x0A,0x0A,0x72,0x65,0x62,0x75,0x69,0x6C,
		0x64,0x3A,0x20,0x63,0x6C,0x65,0x61,0x6E,0x20,0x61,0x6C,0x6C,0x0A,0x09,0x40,0x65,
		0x63,0x68,0x6F,0x20,0x20,0x2D,0x2D,0x2D,0x2D,0x2D,0x2D,0x2D,0x2D,0x2D,0x2D,0x2D,
		0x2D,0x2D,0x2D,0x2D,0x2D,0x2D,0x2D,0x2D,0x2D,0x2D,0x2D,0x2D,0x2D,0x2D,0x2D,0x0A,
		0x09,0x40,0x65,0x63,0x68,0x6F,0x20,0x20,0x61,0x6C,0x6C,0x20,0x72,0x65,0x62,0x75,
		0x69,0x6C,0x64,0x00
	};

	return (char*)(data);
}

static const char* GetMakeconf()
{
	static u_char data[] = {
		0x23,0x20,0x6D,0x61,0x6B,0x65,0x20,0x63,0x6F,0x6E,0x66,0x69,0x67,0x0A,0x23,0x20,
		0x63,0x72,0x65,0x61,0x74,0x65,0x64,0x20,0x62,0x79,0x20,0x78,0x75,0x6E,0x67,0x65,
		0x6E,0x0A,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,
		0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,
		0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,
		0x23,0x23,0x0A,0x0A,0x52,0x4D,0x09,0x09,0x09,0x09,0x3D,0x20,0x72,0x6D,0x0A,0x4D,
		0x41,0x4B,0x45,0x09,0x09,0x09,0x3D,0x20,0x6D,0x61,0x6B,0x65,0x0A,0x41,0x52,0x4C,
		0x49,0x42,0x09,0x09,0x09,0x3D,0x20,0x61,0x72,0x20,0x72,0x63,0x73,0x0A,0x4D,0x4B,
		0x44,0x49,0x52,0x09,0x09,0x09,0x3D,0x20,0x6D,0x6B,0x64,0x69,0x72,0x0A,0x52,0x4D,
		0x44,0x49,0x52,0x09,0x09,0x09,0x3D,0x20,0x24,0x28,0x52,0x4D,0x29,0x20,0x2D,0x72,
		0x0A,0x43,0x4F,0x50,0x59,0x46,0x49,0x4C,0x45,0x09,0x09,0x3D,0x20,0x63,0x70,0x0A,
		0x4D,0x4F,0x56,0x45,0x46,0x49,0x4C,0x45,0x09,0x09,0x3D,0x20,0x6D,0x76,0x0A,0x44,
		0x45,0x4C,0x45,0x54,0x45,0x46,0x49,0x4C,0x45,0x09,0x09,0x3D,0x20,0x24,0x28,0x52,
		0x4D,0x29,0x20,0x2D,0x66,0x0A,0x0A,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,
		0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,
		0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,
		0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x0A,0x0A,0x4F,0x53,0x42,0x49,0x54,0x53,0x09,
		0x09,0x09,0x3D,0x20,0x24,0x28,0x4F,0x53,0x42,0x49,0x54,0x29,0x0A,0x4F,0x53,0x4E,
		0x41,0x4D,0x45,0x09,0x09,0x09,0x3D,0x20,0x24,0x28,0x4F,0x53,0x54,0x59,0x50,0x45,
		0x29,0x0A,0x0A,0x4C,0x49,0x42,0x5F,0x45,0x58,0x54,0x4E,0x41,0x4D,0x45,0x09,0x09,
		0x3D,0x20,0x2E,0x61,0x0A,0x44,0x4C,0x4C,0x5F,0x45,0x58,0x54,0x4E,0x41,0x4D,0x45,
		0x09,0x09,0x3D,0x20,0x2E,0x73,0x6F,0x0A,0x42,0x49,0x4E,0x5F,0x45,0x58,0x54,0x4E,
		0x41,0x4D,0x45,0x09,0x09,0x3D,0x0A,0x0A,0x48,0x4F,0x4D,0x45,0x5F,0x50,0x41,0x54,
		0x48,0x09,0x09,0x3D,0x20,0x24,0x28,0x53,0x4F,0x55,0x52,0x43,0x45,0x5F,0x48,0x4F,
		0x4D,0x45,0x29,0x0A,0x50,0x52,0x4F,0x44,0x55,0x43,0x54,0x5F,0x50,0x41,0x54,0x48,
		0x09,0x3D,0x20,0x24,0x28,0x48,0x4F,0x4D,0x45,0x5F,0x50,0x41,0x54,0x48,0x29,0x2F,
		0x70,0x72,0x6F,0x64,0x75,0x63,0x74,0x0A,0x4C,0x49,0x42,0x52,0x41,0x52,0x59,0x5F,
		0x50,0x41,0x54,0x48,0x09,0x3D,0x20,0x24,0x28,0x48,0x4F,0x4D,0x45,0x5F,0x50,0x41,
		0x54,0x48,0x29,0x2F,0x6C,0x69,0x62,0x72,0x61,0x72,0x79,0x0A,0x42,0x49,0x4E,0x5F,
		0x4F,0x55,0x54,0x50,0x55,0x54,0x5F,0x50,0x41,0x54,0x48,0x09,0x3D,0x20,0x24,0x28,
		0x50,0x52,0x4F,0x44,0x55,0x43,0x54,0x5F,0x50,0x41,0x54,0x48,0x29,0x2F,0x62,0x69,
		0x6E,0x0A,0x4C,0x49,0x42,0x5F,0x4F,0x55,0x54,0x50,0x55,0x54,0x5F,0x50,0x41,0x54,
		0x48,0x09,0x3D,0x20,0x24,0x28,0x50,0x52,0x4F,0x44,0x55,0x43,0x54,0x5F,0x50,0x41,
		0x54,0x48,0x29,0x2F,0x6C,0x69,0x62,0x0A,0x44,0x4C,0x4C,0x5F,0x4F,0x55,0x54,0x50,
		0x55,0x54,0x5F,0x50,0x41,0x54,0x48,0x09,0x3D,0x20,0x24,0x28,0x50,0x52,0x4F,0x44,
		0x55,0x43,0x54,0x5F,0x50,0x41,0x54,0x48,0x29,0x2F,0x64,0x6C,0x6C,0x0A,0x0A,0x23,
		0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,
		0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,
		0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x0A,
		0x0A,0x50,0x4C,0x41,0x54,0x46,0x4F,0x52,0x4D,0x4C,0x49,0x4E,0x4B,0x5F,0x57,0x49,
		0x4E,0x3D,0x20,0x2D,0x6C,0x77,0x73,0x32,0x5F,0x33,0x32,0x20,0x2D,0x6C,0x70,0x73,
		0x61,0x70,0x69,0x20,0x2D,0x6C,0x6D,0x0A,0x50,0x4C,0x41,0x54,0x46,0x4F,0x52,0x4D,
		0x4C,0x49,0x4E,0x4B,0x5F,0x4C,0x4E,0x58,0x3D,0x20,0x2D,0x6C,0x75,0x74,0x69,0x6C,
		0x20,0x2D,0x6C,0x64,0x6C,0x20,0x2D,0x6C,0x6D,0x0A,0x0A,0x50,0x4C,0x41,0x54,0x46,
		0x4F,0x52,0x4D,0x4C,0x49,0x4E,0x4B,0x09,0x3D,0x20,0x24,0x28,0x50,0x4C,0x41,0x54,
		0x46,0x4F,0x52,0x4D,0x4C,0x49,0x4E,0x4B,0x5F,0x24,0x28,0x4F,0x53,0x4E,0x41,0x4D,
		0x45,0x29,0x29,0x0A,0x0A,0x49,0x4E,0x43,0x50,0x41,0x54,0x48,0x09,0x09,0x09,0x3D,
		0x20,0x2D,0x49,0x24,0x28,0x4C,0x49,0x42,0x52,0x41,0x52,0x59,0x5F,0x50,0x41,0x54,
		0x48,0x29,0x20,0x2D,0x49,0x2E,0x20,0x2D,0x49,0x2E,0x2F,0x69,0x6E,0x63,0x0A,0x4C,
		0x49,0x42,0x4C,0x49,0x4E,0x4B,0x09,0x09,0x09,0x3D,0x20,0x2D,0x4C,0x24,0x28,0x4C,
		0x49,0x42,0x5F,0x4F,0x55,0x54,0x50,0x55,0x54,0x5F,0x50,0x41,0x54,0x48,0x29,0x20,
		0x2D,0x6C,0x73,0x74,0x64,0x78,0x20,0x2D,0x6C,0x63,0x6C,0x69,0x62,0x20,0x24,0x28,
		0x50,0x4C,0x41,0x54,0x46,0x4F,0x52,0x4D,0x4C,0x49,0x4E,0x4B,0x29,0x0A,0x44,0x4C,
		0x4C,0x4C,0x49,0x4E,0x4B,0x09,0x09,0x09,0x3D,0x20,0x2D,0x4C,0x24,0x28,0x4C,0x49,
		0x42,0x5F,0x4F,0x55,0x54,0x50,0x55,0x54,0x5F,0x50,0x41,0x54,0x48,0x29,0x20,0x2D,
		0x6C,0x73,0x74,0x64,0x78,0x20,0x2D,0x6C,0x63,0x6C,0x69,0x62,0x20,0x24,0x28,0x50,
		0x4C,0x41,0x54,0x46,0x4F,0x52,0x4D,0x4C,0x49,0x4E,0x4B,0x29,0x0A,0x0A,0x23,0x23,
		0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,
		0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,
		0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x0A,0x0A,
		0x43,0x43,0x5F,0x57,0x49,0x4E,0x09,0x09,0x09,0x3D,0x20,0x67,0x2B,0x2B,0x20,0x2D,
		0x73,0x74,0x64,0x3D,0x63,0x2B,0x2B,0x31,0x31,0x0A,0x43,0x43,0x5F,0x46,0x4C,0x41,
		0x47,0x5F,0x57,0x49,0x4E,0x09,0x09,0x3D,0x20,0x2D,0x4F,0x32,0x20,0x2D,0x6D,0x24,
		0x28,0x4F,0x53,0x42,0x49,0x54,0x53,0x29,0x20,0x2D,0x70,0x74,0x68,0x72,0x65,0x61,
		0x64,0x20,0x2D,0x66,0x50,0x49,0x43,0x20,0x2D,0x73,0x74,0x61,0x74,0x69,0x63,0x2D,
		0x6C,0x69,0x62,0x73,0x74,0x64,0x63,0x2B,0x2B,0x20,0x2D,0x73,0x74,0x61,0x74,0x69,
		0x63,0x2D,0x6C,0x69,0x62,0x67,0x63,0x63,0x20,0x2D,0x57,0x6C,0x2C,0x2D,0x42,0x73,
		0x74,0x61,0x74,0x69,0x63,0x2C,0x2D,0x2D,0x77,0x68,0x6F,0x6C,0x65,0x2D,0x61,0x72,
		0x63,0x68,0x69,0x76,0x65,0x20,0x2D,0x6C,0x77,0x69,0x6E,0x70,0x74,0x68,0x72,0x65,
		0x61,0x64,0x20,0x2D,0x57,0x6C,0x2C,0x2D,0x42,0x64,0x79,0x6E,0x61,0x6D,0x69,0x63,
		0x2C,0x2D,0x2D,0x6E,0x6F,0x2D,0x77,0x68,0x6F,0x6C,0x65,0x2D,0x61,0x72,0x63,0x68,
		0x69,0x76,0x65,0x0A,0x47,0x44,0x42,0x5F,0x57,0x49,0x4E,0x09,0x09,0x09,0x3D,0x20,
		0x67,0x64,0x62,0x0A,0x43,0x50,0x50,0x5F,0x57,0x49,0x4E,0x09,0x09,0x09,0x3D,0x20,
		0x24,0x28,0x43,0x43,0x5F,0x57,0x49,0x4E,0x29,0x20,0x24,0x28,0x43,0x43,0x5F,0x46,
		0x4C,0x41,0x47,0x5F,0x57,0x49,0x4E,0x29,0x0A,0x47,0x43,0x43,0x5F,0x57,0x49,0x4E,
		0x09,0x09,0x09,0x3D,0x20,0x67,0x63,0x63,0x20,0x24,0x28,0x43,0x43,0x5F,0x46,0x4C,
		0x41,0x47,0x5F,0x57,0x49,0x4E,0x29,0x0A,0x43,0x50,0x50,0x5F,0x44,0x4C,0x4C,0x5F,
		0x57,0x49,0x4E,0x09,0x09,0x3D,0x20,0x24,0x28,0x43,0x50,0x50,0x5F,0x57,0x49,0x4E,
		0x29,0x20,0x2D,0x73,0x68,0x61,0x72,0x65,0x64,0x0A,0x47,0x43,0x43,0x5F,0x44,0x4C,
		0x4C,0x5F,0x57,0x49,0x4E,0x09,0x09,0x3D,0x20,0x24,0x28,0x47,0x43,0x43,0x5F,0x57,
		0x49,0x4E,0x29,0x20,0x2D,0x73,0x68,0x61,0x72,0x65,0x64,0x0A,0x0A,0x43,0x43,0x5F,
		0x4C,0x4E,0x58,0x09,0x09,0x09,0x3D,0x20,0x67,0x2B,0x2B,0x20,0x2D,0x73,0x74,0x64,
		0x3D,0x63,0x2B,0x2B,0x31,0x31,0x0A,0x43,0x43,0x5F,0x46,0x4C,0x41,0x47,0x5F,0x4C,
		0x4E,0x58,0x09,0x09,0x3D,0x20,0x2D,0x4F,0x32,0x20,0x2D,0x6D,0x24,0x28,0x4F,0x53,
		0x42,0x49,0x54,0x53,0x29,0x20,0x2D,0x70,0x74,0x68,0x72,0x65,0x61,0x64,0x20,0x2D,
		0x66,0x50,0x49,0x43,0x20,0x2D,0x44,0x58,0x47,0x5F,0x4C,0x49,0x4E,0x55,0x58,0x0A,
		0x47,0x44,0x42,0x5F,0x4C,0x4E,0x58,0x09,0x09,0x09,0x3D,0x20,0x67,0x64,0x62,0x0A,
		0x43,0x50,0x50,0x5F,0x4C,0x4E,0x58,0x09,0x09,0x09,0x3D,0x20,0x24,0x28,0x43,0x43,
		0x5F,0x4C,0x4E,0x58,0x29,0x20,0x24,0x28,0x43,0x43,0x5F,0x46,0x4C,0x41,0x47,0x5F,
		0x4C,0x4E,0x58,0x29,0x0A,0x47,0x43,0x43,0x5F,0x4C,0x4E,0x58,0x09,0x09,0x09,0x3D,
		0x20,0x67,0x63,0x63,0x20,0x24,0x28,0x43,0x43,0x5F,0x46,0x4C,0x41,0x47,0x5F,0x4C,
		0x4E,0x58,0x29,0x0A,0x43,0x50,0x50,0x5F,0x44,0x4C,0x4C,0x5F,0x4C,0x4E,0x58,0x09,
		0x09,0x3D,0x20,0x24,0x28,0x43,0x50,0x50,0x5F,0x4C,0x4E,0x58,0x29,0x20,0x2D,0x73,
		0x68,0x61,0x72,0x65,0x64,0x0A,0x47,0x43,0x43,0x5F,0x44,0x4C,0x4C,0x5F,0x4C,0x4E,
		0x58,0x09,0x09,0x3D,0x20,0x24,0x28,0x47,0x43,0x43,0x5F,0x4C,0x4E,0x58,0x29,0x20,
		0x2D,0x73,0x68,0x61,0x72,0x65,0x64,0x0A,0x0A,0x43,0x43,0x09,0x09,0x09,0x09,0x3D,
		0x20,0x24,0x28,0x43,0x43,0x5F,0x24,0x28,0x4F,0x53,0x4E,0x41,0x4D,0x45,0x29,0x29,
		0x0A,0x43,0x50,0x50,0x09,0x09,0x09,0x09,0x3D,0x20,0x24,0x28,0x43,0x50,0x50,0x5F,
		0x24,0x28,0x4F,0x53,0x4E,0x41,0x4D,0x45,0x29,0x29,0x0A,0x47,0x43,0x43,0x09,0x09,
		0x09,0x09,0x3D,0x20,0x24,0x28,0x47,0x43,0x43,0x5F,0x24,0x28,0x4F,0x53,0x4E,0x41,
		0x4D,0x45,0x29,0x29,0x0A,0x47,0x44,0x42,0x09,0x09,0x09,0x09,0x3D,0x20,0x24,0x28,
		0x47,0x44,0x42,0x5F,0x24,0x28,0x4F,0x53,0x4E,0x41,0x4D,0x45,0x29,0x29,0x0A,0x43,
		0x50,0x50,0x5F,0x44,0x4C,0x4C,0x09,0x09,0x09,0x3D,0x20,0x24,0x28,0x43,0x50,0x50,
		0x5F,0x44,0x4C,0x4C,0x5F,0x24,0x28,0x4F,0x53,0x4E,0x41,0x4D,0x45,0x29,0x29,0x0A,
		0x47,0x43,0x43,0x5F,0x44,0x4C,0x4C,0x09,0x09,0x09,0x3D,0x20,0x24,0x28,0x47,0x43,
		0x43,0x5F,0x44,0x4C,0x4C,0x5F,0x24,0x28,0x4F,0x53,0x4E,0x41,0x4D,0x45,0x29,0x29,
		0x0A,0x0A,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,
		0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,
		0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,
		0x23,0x23,0x0A,0x0A,0x49,0x4E,0x43,0x5F,0x53,0x51,0x4C,0x49,0x54,0x45,0x09,0x09,
		0x3D,0x20,0x2D,0x49,0x24,0x28,0x4C,0x49,0x42,0x52,0x41,0x52,0x59,0x5F,0x50,0x41,
		0x54,0x48,0x29,0x2F,0x73,0x71,0x6C,0x69,0x74,0x65,0x0A,0x4C,0x49,0x42,0x5F,0x53,
		0x51,0x4C,0x49,0x54,0x45,0x09,0x09,0x3D,0x20,0x2D,0x4C,0x24,0x28,0x4C,0x49,0x42,
		0x5F,0x4F,0x55,0x54,0x50,0x55,0x54,0x5F,0x50,0x41,0x54,0x48,0x29,0x20,0x2D,0x6C,
		0x73,0x71,0x6C,0x69,0x74,0x65,0x0A,0x0A,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,
		0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,
		0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,
		0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x0A,0x0A,0x49,0x4E,0x43,0x5F,0x4F,0x50,
		0x45,0x4E,0x53,0x53,0x4C,0x09,0x09,0x3D,0x20,0x2D,0x49,0x24,0x28,0x4C,0x49,0x42,
		0x5F,0x4F,0x55,0x54,0x50,0x55,0x54,0x5F,0x50,0x41,0x54,0x48,0x29,0x2F,0x6F,0x70,
		0x65,0x6E,0x73,0x73,0x6C,0x2F,0x69,0x6E,0x63,0x0A,0x4C,0x49,0x42,0x5F,0x4F,0x50,
		0x45,0x4E,0x53,0x53,0x4C,0x09,0x09,0x3D,0x20,0x2D,0x4C,0x24,0x28,0x4C,0x49,0x42,
		0x5F,0x4F,0x55,0x54,0x50,0x55,0x54,0x5F,0x50,0x41,0x54,0x48,0x29,0x20,0x2D,0x6C,
		0x6F,0x70,0x65,0x6E,0x73,0x73,0x6C,0x20,0x2D,0x4C,0x24,0x28,0x4C,0x49,0x42,0x5F,
		0x4F,0x55,0x54,0x50,0x55,0x54,0x5F,0x50,0x41,0x54,0x48,0x29,0x2F,0x6F,0x70,0x65,
		0x6E,0x73,0x73,0x6C,0x2F,0x6C,0x69,0x62,0x20,0x2D,0x6C,0x73,0x73,0x6C,0x20,0x2D,
		0x6C,0x63,0x72,0x79,0x70,0x74,0x6F,0x0A,0x0A,0x23,0x23,0x23,0x23,0x23,0x23,0x23,
		0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,
		0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,
		0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x0A,0x0A,0x49,0x4E,0x43,0x5F,0x50,
		0x59,0x54,0x48,0x4F,0x4E,0x09,0x09,0x3D,0x20,0x2D,0x49,0x24,0x28,0x4C,0x49,0x42,
		0x5F,0x4F,0x55,0x54,0x50,0x55,0x54,0x5F,0x50,0x41,0x54,0x48,0x29,0x2F,0x70,0x79,
		0x74,0x68,0x6F,0x6E,0x2F,0x69,0x6E,0x63,0x0A,0x4C,0x49,0x42,0x5F,0x50,0x59,0x54,
		0x48,0x4F,0x4E,0x09,0x09,0x3D,0x20,0x2D,0x4C,0x24,0x28,0x4C,0x49,0x42,0x5F,0x4F,
		0x55,0x54,0x50,0x55,0x54,0x5F,0x50,0x41,0x54,0x48,0x29,0x2F,0x70,0x79,0x74,0x68,
		0x6F,0x6E,0x2F,0x6C,0x69,0x62,0x20,0x2D,0x6C,0x70,0x79,0x74,0x68,0x6F,0x6E,0x33,
		0x00
	};
	
	return (char*)(data);
}

static const char* GetBashfile()
{
	static u_char data[] = {
		0x23,0x20,0x73,0x68,0x65,0x6C,0x6C,0x20,0x70,0x72,0x6F,0x66,0x69,0x6C,0x65,0x0A,
		0x23,0x20,0x63,0x72,0x65,0x61,0x74,0x65,0x64,0x20,0x62,0x79,0x20,0x78,0x75,0x6E,
		0x67,0x65,0x6E,0x0A,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,
		0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,
		0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,
		0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x0A,0x0A,0x4F,
		0x53,0x54,0x59,0x50,0x45,0x3D,0x60,0x75,0x6E,0x61,0x6D,0x65,0x60,0x0A,0x45,0x4E,
		0x56,0x50,0x41,0x54,0x48,0x4A,0x4F,0x49,0x4E,0x3D,0x27,0x3A,0x27,0x0A,0x0A,0x69,
		0x66,0x20,0x5B,0x20,0x22,0x24,0x4F,0x53,0x54,0x59,0x50,0x45,0x22,0x20,0x3D,0x3D,
		0x20,0x22,0x4C,0x69,0x6E,0x75,0x78,0x22,0x20,0x5D,0x0A,0x74,0x68,0x65,0x6E,0x0A,
		0x09,0x65,0x78,0x70,0x6F,0x72,0x74,0x20,0x4F,0x53,0x54,0x59,0x50,0x45,0x3D,0x4C,
		0x4E,0x58,0x0A,0x09,0x65,0x78,0x70,0x6F,0x72,0x74,0x20,0x45,0x4E,0x56,0x50,0x41,
		0x54,0x48,0x4A,0x4F,0x49,0x4E,0x3D,0x22,0x3A,0x22,0x0A,0x65,0x6C,0x73,0x65,0x0A,
		0x09,0x65,0x78,0x70,0x6F,0x72,0x74,0x20,0x4F,0x53,0x54,0x59,0x50,0x45,0x3D,0x57,
		0x49,0x4E,0x0A,0x09,0x65,0x78,0x70,0x6F,0x72,0x74,0x20,0x45,0x4E,0x56,0x50,0x41,
		0x54,0x48,0x4A,0x4F,0x49,0x4E,0x3D,0x22,0x3B,0x22,0x0A,0x66,0x69,0x0A,0x0A,0x69,
		0x66,0x20,0x5B,0x20,0x2D,0x7A,0x20,0x24,0x53,0x4F,0x55,0x52,0x43,0x45,0x5F,0x48,
		0x4F,0x4D,0x45,0x20,0x5D,0x0A,0x74,0x68,0x65,0x6E,0x0A,0x09,0x65,0x78,0x70,0x6F,
		0x72,0x74,0x20,0x53,0x4F,0x55,0x52,0x43,0x45,0x5F,0x48,0x4F,0x4D,0x45,0x3D,0x24,
		0x48,0x4F,0x4D,0x45,0x0A,0x66,0x69,0x0A,0x0A,0x69,0x66,0x20,0x5B,0x20,0x60,0x77,
		0x68,0x69,0x63,0x68,0x20,0x67,0x65,0x74,0x63,0x6F,0x6E,0x66,0x20,0x32,0x3E,0x20,
		0x2F,0x64,0x65,0x76,0x2F,0x6E,0x75,0x6C,0x6C,0x20,0x7C,0x20,0x77,0x63,0x20,0x2D,
		0x6C,0x60,0x20,0x2D,0x67,0x74,0x20,0x30,0x20,0x5D,0x0A,0x74,0x68,0x65,0x6E,0x0A,
		0x09,0x65,0x78,0x70,0x6F,0x72,0x74,0x20,0x4F,0x53,0x42,0x49,0x54,0x3D,0x60,0x67,
		0x65,0x74,0x63,0x6F,0x6E,0x66,0x20,0x4C,0x4F,0x4E,0x47,0x5F,0x42,0x49,0x54,0x60,
		0x0A,0x65,0x6C,0x73,0x65,0x0A,0x09,0x65,0x78,0x70,0x6F,0x72,0x74,0x20,0x4F,0x53,
		0x42,0x49,0x54,0x3D,0x36,0x34,0x0A,0x66,0x69,0x0A,0x0A,0x69,0x66,0x20,0x5B,0x20,
		0x2D,0x7A,0x20,0x24,0x50,0x52,0x4F,0x44,0x55,0x43,0x54,0x5F,0x48,0x4F,0x4D,0x45,
		0x20,0x5D,0x0A,0x74,0x68,0x65,0x6E,0x0A,0x09,0x65,0x78,0x70,0x6F,0x72,0x74,0x20,
		0x50,0x52,0x4F,0x44,0x55,0x43,0x54,0x5F,0x48,0x4F,0x4D,0x45,0x3D,0x24,0x53,0x4F,
		0x55,0x52,0x43,0x45,0x5F,0x48,0x4F,0x4D,0x45,0x2F,0x70,0x72,0x6F,0x64,0x75,0x63,
		0x74,0x0A,0x66,0x69,0x0A,0x0A,0x4D,0x59,0x53,0x51,0x4C,0x5F,0x48,0x4F,0x4D,0x45,
		0x3D,0x24,0x50,0x52,0x4F,0x44,0x55,0x43,0x54,0x5F,0x48,0x4F,0x4D,0x45,0x2F,0x6C,
		0x69,0x62,0x2F,0x6D,0x79,0x73,0x71,0x6C,0x0A,0x50,0x59,0x54,0x48,0x4F,0x4E,0x5F,
		0x48,0x4F,0x4D,0x45,0x3D,0x24,0x50,0x52,0x4F,0x44,0x55,0x43,0x54,0x5F,0x48,0x4F,
		0x4D,0x45,0x2F,0x6C,0x69,0x62,0x2F,0x70,0x79,0x74,0x68,0x6F,0x6E,0x0A,0x4F,0x50,
		0x45,0x4E,0x53,0x53,0x4C,0x5F,0x48,0x4F,0x4D,0x45,0x3D,0x24,0x50,0x52,0x4F,0x44,
		0x55,0x43,0x54,0x5F,0x48,0x4F,0x4D,0x45,0x2F,0x6C,0x69,0x62,0x2F,0x6F,0x70,0x65,
		0x6E,0x73,0x73,0x6C,0x0A,0x0A,0x65,0x78,0x70,0x6F,0x72,0x74,0x20,0x4C,0x41,0x4E,
		0x47,0x3D,0x7A,0x68,0x5F,0x43,0x4E,0x2E,0x55,0x54,0x46,0x2D,0x38,0x0A,0x65,0x78,
		0x70,0x6F,0x72,0x74,0x20,0x50,0x41,0x54,0x48,0x3D,0x24,0x50,0x52,0x4F,0x44,0x55,
		0x43,0x54,0x5F,0x48,0x4F,0x4D,0x45,0x2F,0x62,0x69,0x6E,0x3A,0x24,0x50,0x41,0x54,
		0x48,0x0A,0x65,0x78,0x70,0x6F,0x72,0x74,0x20,0x4C,0x44,0x5F,0x4C,0x49,0x42,0x52,
		0x41,0x52,0x59,0x5F,0x50,0x41,0x54,0x48,0x3D,0x24,0x4D,0x59,0x53,0x51,0x4C,0x5F,
		0x48,0x4F,0x4D,0x45,0x2F,0x6C,0x69,0x62,0x3A,0x24,0x50,0x59,0x54,0x48,0x4F,0x4E,
		0x5F,0x48,0x4F,0x4D,0x45,0x2F,0x6C,0x69,0x62,0x3A,0x24,0x4F,0x50,0x45,0x4E,0x53,
		0x53,0x4C,0x5F,0x48,0x4F,0x4D,0x45,0x2F,0x6C,0x69,0x62,0x3A,0x24,0x4C,0x44,0x5F,
		0x4C,0x49,0x42,0x52,0x41,0x52,0x59,0x5F,0x50,0x41,0x54,0x48,0x0A,0x0A,0x69,0x66,
		0x20,0x5B,0x20,0x22,0x24,0x4F,0x53,0x54,0x59,0x50,0x45,0x22,0x20,0x3D,0x3D,0x20,
		0x22,0x57,0x49,0x4E,0x22,0x20,0x5D,0x0A,0x74,0x68,0x65,0x6E,0x0A,0x09,0x65,0x78,
		0x70,0x6F,0x72,0x74,0x20,0x50,0x41,0x54,0x48,0x3D,0x24,0x4C,0x44,0x5F,0x4C,0x49,
		0x42,0x52,0x41,0x52,0x59,0x5F,0x50,0x41,0x54,0x48,0x3A,0x24,0x50,0x41,0x54,0x48,
		0x0A,0x66,0x69,0x0A,0x0A,0x69,0x66,0x20,0x5B,0x20,0x2D,0x64,0x20,0x22,0x24,0x53,
		0x4F,0x55,0x52,0x43,0x45,0x5F,0x48,0x4F,0x4D,0x45,0x2F,0x77,0x65,0x62,0x61,0x70,
		0x70,0x22,0x20,0x5D,0x0A,0x74,0x68,0x65,0x6E,0x0A,0x09,0x61,0x6C,0x69,0x61,0x73,
		0x20,0x73,0x72,0x63,0x3D,0x27,0x63,0x64,0x20,0x24,0x53,0x4F,0x55,0x52,0x43,0x45,
		0x5F,0x48,0x4F,0x4D,0x45,0x27,0x0A,0x09,0x61,0x6C,0x69,0x61,0x73,0x20,0x77,0x65,
		0x62,0x3D,0x27,0x63,0x64,0x20,0x24,0x53,0x4F,0x55,0x52,0x43,0x45,0x5F,0x48,0x4F,
		0x4D,0x45,0x2F,0x77,0x65,0x62,0x61,0x70,0x70,0x27,0x0A,0x09,0x61,0x6C,0x69,0x61,
		0x73,0x20,0x6C,0x69,0x62,0x3D,0x27,0x63,0x64,0x20,0x24,0x53,0x4F,0x55,0x52,0x43,
		0x45,0x5F,0x48,0x4F,0x4D,0x45,0x2F,0x6C,0x69,0x62,0x72,0x61,0x72,0x79,0x27,0x0A,
		0x09,0x61,0x6C,0x69,0x61,0x73,0x20,0x72,0x65,0x64,0x69,0x73,0x3D,0x27,0x63,0x70,
		0x70,0x73,0x68,0x65,0x6C,0x6C,0x20,0x24,0x53,0x4F,0x55,0x52,0x43,0x45,0x5F,0x48,
		0x4F,0x4D,0x45,0x2F,0x63,0x70,0x70,0x73,0x68,0x65,0x6C,0x6C,0x2F,0x72,0x65,0x64,
		0x69,0x73,0x2E,0x63,0x70,0x70,0x27,0x0A,0x66,0x69,0x0A,0x0A,0x23,0x23,0x23,0x23,
		0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,
		0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,
		0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,
		0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x0A,0x0A,0x66,0x75,0x6E,0x63,0x74,0x69,
		0x6F,0x6E,0x20,0x65,0x6E,0x64,0x73,0x76,0x72,0x0A,0x7B,0x0A,0x09,0x77,0x65,0x62,
		0x73,0x65,0x72,0x76,0x65,0x72,0x20,0x2D,0x6B,0x20,0x3E,0x20,0x2F,0x64,0x65,0x76,
		0x2F,0x6E,0x75,0x6C,0x6C,0x20,0x32,0x3E,0x26,0x31,0x0A,0x7D,0x0A,0x0A,0x66,0x75,
		0x6E,0x63,0x74,0x69,0x6F,0x6E,0x20,0x64,0x73,0x70,0x73,0x76,0x72,0x0A,0x7B,0x0A,
		0x09,0x69,0x66,0x20,0x5B,0x20,0x22,0x24,0x4F,0x53,0x54,0x59,0x50,0x45,0x22,0x20,
		0x3D,0x3D,0x20,0x22,0x57,0x49,0x4E,0x22,0x20,0x5D,0x0A,0x09,0x74,0x68,0x65,0x6E,
		0x0A,0x09,0x09,0x74,0x61,0x73,0x6B,0x6C,0x69,0x73,0x74,0x20,0x7C,0x20,0x67,0x72,
		0x65,0x70,0x20,0x77,0x65,0x62,0x73,0x65,0x72,0x76,0x65,0x72,0x0A,0x09,0x65,0x6C,
		0x73,0x65,0x0A,0x09,0x09,0x70,0x73,0x20,0x2D,0x65,0x66,0x20,0x7C,0x20,0x67,0x72,
		0x65,0x70,0x20,0x77,0x65,0x62,0x73,0x65,0x72,0x76,0x65,0x72,0x20,0x7C,0x20,0x67,
		0x72,0x65,0x70,0x20,0x2D,0x76,0x20,0x67,0x72,0x65,0x70,0x20,0x7C,0x20,0x67,0x72,
		0x65,0x70,0x20,0x2D,0x76,0x20,0x64,0x61,0x65,0x6D,0x6F,0x6E,0x20,0x7C,0x20,0x67,
		0x72,0x65,0x70,0x20,0x2D,0x76,0x20,0x27,0x73,0x68,0x20,0x2D,0x63,0x27,0x20,0x7C,
		0x20,0x67,0x72,0x65,0x70,0x20,0x60,0x77,0x68,0x6F,0x61,0x6D,0x69,0x60,0x0A,0x09,
		0x66,0x69,0x0A,0x7D,0x0A,0x0A,0x66,0x75,0x6E,0x63,0x74,0x69,0x6F,0x6E,0x20,0x73,
		0x74,0x72,0x73,0x76,0x72,0x0A,0x7B,0x0A,0x09,0x64,0x61,0x65,0x6D,0x6F,0x6E,0x20,
		0x24,0x50,0x52,0x4F,0x44,0x55,0x43,0x54,0x5F,0x48,0x4F,0x4D,0x45,0x2F,0x62,0x69,
		0x6E,0x2F,0x77,0x65,0x62,0x73,0x65,0x72,0x76,0x65,0x72,0x20,0x24,0x53,0x4F,0x55,
		0x52,0x43,0x45,0x5F,0x48,0x4F,0x4D,0x45,0x2F,0x77,0x65,0x62,0x61,0x70,0x70,0x2F,
		0x65,0x74,0x63,0x2F,0x63,0x6F,0x6E,0x66,0x69,0x67,0x2E,0x6C,0x75,0x61,0x0A,0x7D,
		0x0A,0x0A,0x66,0x75,0x6E,0x63,0x74,0x69,0x6F,0x6E,0x20,0x77,0x65,0x62,0x70,0x61,
		0x63,0x6B,0x0A,0x7B,0x0A,0x09,0x69,0x66,0x20,0x5B,0x20,0x2D,0x64,0x20,0x22,0x24,
		0x53,0x4F,0x55,0x52,0x43,0x45,0x5F,0x48,0x4F,0x4D,0x45,0x2F,0x77,0x65,0x62,0x61,
		0x70,0x70,0x2F,0x72,0x65,0x73,0x2F,0x6C,0x69,0x62,0x22,0x20,0x5D,0x0A,0x09,0x74,
		0x68,0x65,0x6E,0x0A,0x09,0x09,0x63,0x64,0x20,0x24,0x53,0x4F,0x55,0x52,0x43,0x45,
		0x5F,0x48,0x4F,0x4D,0x45,0x2F,0x77,0x65,0x62,0x61,0x70,0x70,0x2F,0x72,0x65,0x73,
		0x2F,0x6C,0x69,0x62,0x0A,0x09,0x09,0x63,0x61,0x74,0x20,0x76,0x75,0x65,0x2E,0x6A,
		0x73,0x20,0x6A,0x71,0x75,0x65,0x72,0x79,0x2E,0x6A,0x73,0x20,0x71,0x72,0x63,0x6F,
		0x64,0x65,0x2E,0x6A,0x73,0x20,0x6D,0x61,0x72,0x6B,0x65,0x64,0x2E,0x6A,0x73,0x20,
		0x63,0x6C,0x69,0x70,0x62,0x6F,0x61,0x72,0x64,0x2E,0x6A,0x73,0x20,0x75,0x74,0x69,
		0x6C,0x73,0x2E,0x6A,0x73,0x20,0x7C,0x20,0x67,0x7A,0x69,0x70,0x20,0x2D,0x39,0x20,
		0x3E,0x20,0x75,0x74,0x69,0x6C,0x73,0x2E,0x6A,0x73,0x2E,0x67,0x7A,0x69,0x70,0x0A,
		0x09,0x09,0x63,0x64,0x20,0x2D,0x20,0x3E,0x20,0x2F,0x64,0x65,0x76,0x2F,0x6E,0x75,
		0x6C,0x6C,0x0A,0x09,0x09,0x77,0x65,0x62,0x73,0x65,0x72,0x76,0x65,0x72,0x20,0x2D,
		0x72,0x0A,0x09,0x66,0x69,0x0A,0x7D,0x00
	};

	return (char*)(data);
}

bool HasFile(const string& path)
{
	FILE* file = fopen(path.c_str(), "rb");

	if (file == NULL) return false;
	
	fclose(file);

	return true;
}

string GetFileContent(const string& path)
{
	string str;
	string res;
	ifstream file;

	file.open(path);

	while (getline(file, str))
	{
		res += str + "\n";
	}

	file.close();

	return res;
}

bool AppendFile(const string& path, const string& content, bool clear = false)
{
	FILE* file = NULL;
	string msg = content;

	file = fopen(path.c_str(), clear ? "wb+" : "ab+");

	if (file == NULL) return false;

	fwrite(msg.c_str(), msg.length(), 1, file);

	fclose(file);

	return true;
}

string replace(const string& str, const string& src, const string& dest)
{
	if (str.empty()) return str;

	string res;
	const char* q = NULL;
	const char* p = str.c_str();

	while (*p)
	{
		if ((q = strstr(p, src.c_str())) == NULL)
		{
			res.append(p);

			break;
		}

		res.append(p, q);
		res.append(dest);
		p = q + src.length();
	}

	return res;
}

int main(int argc, char** argv)
{
	char buffer[1024] = {0};
	const char* home = getenv("HOME");
	const char* path = getcwd(buffer, sizeof(buffer) - 1);
	
	if (home == NULL || path == NULL)
	{
		printf("getcwd failed[%d][%s]\n", errno, strerror(errno));
		return -1;
	}

	string tmp;
	string profile = GetBashfile();
	string makefile = GetMakefile();
	string makeconf = GetMakeconf();
	string filepath = replace(path, "\\", "/");
	string bashfile = replace(home, "\\", "/") + "/.bash_profile";

	path = filepath.c_str();

	string content = GetFileContent(bashfile);
	const char* javahome = getenv("JAVA_HOME");

	if (javahome && *javahome)
	{
		tmp = replace(javahome, "\\", "/");
		tmp = replace(tmp, " ", "\\ ") + "/include";

#ifdef __WINNT__
		tmp = string(" -I") + tmp + string(" -I") + tmp + "/win32";
#else
		tmp = string(" -I") + tmp + string(" -I") + tmp + "/linux";
#endif
		makeconf = replace(makeconf, "$(CPP_$(OSNAME))", ("$(CPP_$(OSNAME)) -DXG_WITHJAVA" + tmp).c_str());
	}

	if (HasFile("/usr/include/openssl/ssl.h"))
	{
		makeconf = replace(makeconf, "$(LIB_OUTPUT_PATH)/openssl/inc", "/usr/include");
	}
	else if (HasFile("/usr/local/include/openssl/ssl.h"))
	{
		makeconf = replace(makeconf, "$(LIB_OUTPUT_PATH)/openssl/inc", "/usr/local/include");
	}
	
	if (HasFile("/lib/libssl.so"))
	{
		makeconf = replace(makeconf, "$(LIB_OUTPUT_PATH)/openssl/lib", "/lib");
	}
	else if (HasFile("/lib64/libssl.so"))
	{
		makeconf = replace(makeconf, "$(LIB_OUTPUT_PATH)/openssl/lib", "/lib64");
	}
	else if (HasFile("/usr/lib/libssl.so"))
	{
		makeconf = replace(makeconf, "$(LIB_OUTPUT_PATH)/openssl/lib", "/usr/lib");
	}
	else if (HasFile("/usr/lib64/libssl.so"))
	{
		makeconf = replace(makeconf, "$(LIB_OUTPUT_PATH)/openssl/lib", "/usr/lib64");
	}
	else if (HasFile("/usr/local/lib/libssl.so"))
	{
		makeconf = replace(makeconf, "$(LIB_OUTPUT_PATH)/openssl/lib", "/usr/local/lib");
	}
	else if (HasFile("/usr/local/lib64/libssl.so"))
	{
		makeconf = replace(makeconf, "$(LIB_OUTPUT_PATH)/openssl/lib", "/usr/local/lib64");
	}
	else if (HasFile("/usr/lib/x86_64-linux-gnu/libssl.so"))
	{
		makeconf = replace(makeconf, "$(LIB_OUTPUT_PATH)/openssl/lib", "/usr/lib/x86_64-linux-gnu");
	}

#ifdef __WINNT__
	makeconf = replace(makeconf, "PRODUCT_PATH	= $(HOME_PATH)/product", "PRODUCT_PATH	= $(HOME_PATH)/product/win");
	profile = replace(profile, "PRODUCT_HOME=$SOURCE_HOME/product", "PRODUCT_HOME=$SOURCE_HOME/product/win");
#endif

#ifdef __WINNT__
	if (HasFile("product/win/lib/python/lib/python3.lib"))
#else
	if (HasFile("product/lib/python/lib/libpython3.so"))
#endif
	{
		makeconf = replace(makeconf, "$(CPP_$(OSNAME))", "$(CPP_$(OSNAME)) -DXG_WITHPYTHON");
		makeconf = replace(makeconf, "$(GCC_$(OSNAME))", "$(GCC_$(OSNAME)) -DXG_WITHPYTHON");
	}
	else
	{
		makeconf = replace(makeconf, "LIB_PYTHON", "#LIB_PYTHON");
		makeconf = replace(makeconf, "INC_PYTHON", "#INC_PYTHON");
	}

	const char* mysqlpath = "library/dbx/makefile";

	if ((tmp = GetFileContent(mysqlpath)).empty())
	{
		printf("read file[%s] failed[%d][%s]\n", mysqlpath, errno, strerror(errno));
		return -1;
	}

#ifdef __WINNT__
	if (HasFile("product/win/lib/mysql/lib/mysqlclient.lib"))
#else
	if (HasFile("product/lib/mysql/lib/libmysqlclient.so"))
#endif
	{
		if (tmp.find("target: base pool sqlite sqlitepool mysqlpool") == string::npos)
		{
			tmp = replace(tmp, "target: base pool sqlite sqlitepool", "target: base pool sqlite sqlitepool mysqlpool");	
		}
	}
	else
	{
		if (tmp.find("target: base pool sqlite sqlitepool mysqlpool") != string::npos)
		{
			tmp = replace(tmp, "target: base pool sqlite sqlitepool mysqlpool", "target: base pool sqlite sqlitepool");	
		}
	}

	AppendFile(mysqlpath, tmp, true);

	if (content.find("export SOURCE_HOME=") == string::npos)
	{
#ifdef __WINNT__
		tmp = path;
		tmp[0] = tolower(tmp[0]);
		tmp = replace(tmp, ":", "");

		if (tmp[tmp.length() - 1] == '/') tmp = tmp.substr(0, tmp.length() - 1);

		if (content.find("cygwin") == string::npos)
		{
			tmp = "/" + tmp;
		}
		else
		{
			tmp = "/cygdrive/" + tmp;
		}

		path = tmp.c_str();
#endif
		snprintf(buffer, sizeof(buffer), "\n\nexport SOURCE_HOME=%s\n\nif [ -f %s/.webprofile ]; then\n\t. %s/.webprofile\nfi\n", path, path, path);

		AppendFile(bashfile, buffer, false);
	}

	AppendFile(filepath + "/makefile", makefile, true);
	AppendFile(filepath + "/makeconf", makeconf, true);
	AppendFile(filepath + "/.webprofile", profile, true);

	return 0;
}